import requests
from fake_useragent import UserAgent
ua = UserAgent()
url = 'http://127.0.0.1:8000/useragent/'
headers={
    "user-agent":ua.random
}

res = requests.get(url,headers=headers)
print(res.text)
print(res.request.headers)